// import get_params from '@dfeidao/atom-nodejs/authorization/get-params';
import { IFeidaoAiNodejsComponent } from '@dfeidao/atom-nodejs/interfaces';
import nodejs from '@dfeidao/atom-nodejs/msg/nodejs';
// import whoami from '@dfeidao/atom-nodejs/msg/whoami';
import render from '@dfeidao/atom-nodejs/render/render';
import format from '@dfeidao/atom-web/dt/format';
import set from '@dfeidao/atom-web/global/set';
import p001 from './p001';
import p002 from './p002';
import p004 from './p004';
export default async function na001(fd: IFeidaoAiNodejsComponent) {
	// todow
	// 获取当前登录的用户信息
	// const user = await whoami(fd.data.actionid, fd.data.sessionid);
	// const users = await get_params(fd.data.msg, fd.data.headers, user.productid, '3');
	// 系统参数
	// set('staff_no',users.staff_no);
	// set('staff_name',users.staff_name);
	const staff_no ="YG00000060";
	set('staff_no',staff_no);
	const res = await nodejs<{ dt: Array<{ lnventory_name: string,customer_reviews: string, project_name: string, inventory_time: number, inventory_people: string, record_no: string }>; dtt: Array<{ project_name: string, project_no: string }>; c: number }>(fd.data.actionid, fd.data.sessionid, 'inventory-of-assets/zj-000001/s002',
		{
			filter: {
				pn: 1,
				staff_no
			}
		});
	const tt = res.dt.map((n) => {
		return { ...n, inventory_time: format(n.inventory_time, 0) };
	});


	render(fd.data.node, tt, p002, 'p002');
	render(fd.data.node, res.dtt, p001, 'p001');
	if (res.c > 20) {
	render(fd.data.node, res.c, p004, 'p004');
	}


}


